package x.y.z;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Arrays;

@EnableJpaAuditing
@SpringBootApplication
public class App {
    public static void main(String... args) {
        SpringApplication.run(App.class, args);
    }

    @Autowired
    CustomerRepository customers;

    @Resource UserRepo userRepo;

    public @PostConstruct
    void init() {
        customers.save(new Customer("Dave", "Matthews", Customer.Gender.MALE, //
                new Address("4711 Some Place", "54321", "Charlottesville", "VA")));
        User u = new User("0","1","2");
        u.getRoles().add(new Role("A","AA","AAA"));
        userRepo.save(u);
    }
}
